package acwing._2LanQiao._6DoublePointer_BFS_Graph;
/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._6DoublePointer_BFS_Graph
 * @File : Q1238.java
 * @Author : WangRuoyu
 * @Date : 2023/3/18 10:35
 */

import java.io.*;
import java.util.Arrays;

public class Q1238 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] words = br.readLine().split(" ");

        int n = Integer.parseInt(words[0]);
        int d = Integer.parseInt(words[1]);
        int k = Integer.parseInt(words[2]);

        int[] cnt = new int[100010];
        boolean[] hot = new boolean[100010];
        int[][] log = new int[n + 1][2];
        log[0][0] = -1;

        for (int i = 0; i < n; ++i) {
            words = br.readLine().split(" ");
            log[i + 1][0] = Integer.parseInt(words[0]);
            log[i + 1][1] = Integer.parseInt(words[1]);
        }

        Arrays.sort(log, (o1, o2) -> o1[0] == o2[0] ? o1[1] - o2[1] : o1[0] - o2[0]);

        int i = 0;
        int j = 0;
        while (j < log.length) {
            if (i > 0) {
                cnt[log[i][1]]--;
            }
            i++;
            while (log[i][0] == log[i - 1][0]) {
                cnt[log[i][1]]--;
                i++;
            }
            while (j < log.length && log[j][0] < log[i][0] + d) {
                if (j >= i) {
                    cnt[log[j][1]]++;
                    if (!hot[log[j][1]] && cnt[log[j][1]] >= k) {
                        hot[log[j][1]] = true;
                    }
                }
                j++;
            }
        }

        for (int l = 0; l < hot.length; ++l) {
            if (hot[l]) {
                wr.write(l + "\n");
            }
        }
        wr.flush();
    }
}

